::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::                                                        ::
:: All of the following code is (C) Copywrited 2006-2007, ::
::               Grene Penguin Entertainment.             ::
::                                                        ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off
cls
:menu
title Runserver + Compiler version 1.4
echo Please choose an option below to do that function.
echo Keep posted on the Moparscape Tutorials section for
echo any updates that I post.
echo.
echo c - Compile your server.
echo r - To run your server.
echo e - To exit out of the program.
echo.
echo.
set /p compile=Option: 
if %compile%==c goto compile
if %compile%==C goto compile
if %compile%==r goto run
if %compile%==R goto run
if %compile%==e goto end
if %compile%==E goto end
if %compile%==* goto error
goto error
:compile
cls
title Compiler
goto checkjavac
:compile2
if exist src (goto compile5) else (goto compile3)
:compile3
if exist *.java (goto compile4) else (goto compileerror)
:compile4
%javac% -cp . *.java
pause
cls
goto menu
:compile5
%javac% -cp . .\src\*.java
pause
move .\src\*.class .\classes\
cls
goto menu
:compileerror
cls
echo You need to have Java files for this compiler to compile.
pause
cls
goto menu
:run
cls
title Runserver
goto checkjava
:run2
set runjava=%java% -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
cls
goto run3
:run3
if exist .\classes\server.class (goto run6) else (goto run4)
:run4
if exist .\server.class (goto run5) else (goto servererror)
:run5
%runjava%
pause
cls
goto menu
:run6
set runjava=
set runjava=%java% -cp .;./classes; Server
%runjava%
pause
cls
goto menu
:servererror
cls
title Error
echo You do not have a Server.class. Make sure that you have used the
echo compiler with your server BEFORE you try running it.
pause
cls
goto menu
:error
cls
title Error
echo Invalid command. Please make sure the commands you type
echo in are correct.
pause
cls
goto menu
:end
cls
exit
:checkjavac
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac) else (goto checkjavac2)
:checkjavac2
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac2) else (goto checkjavac3)
:checkjavac3
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac3) else (goto checkjavac4)
:checkjavac4
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac4) else (goto checkjavac5)
:checkjavac5
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac5) else (goto checkjavac6)
:checkjavac6
if exist "%programfiles%\Java\jdk1.6.0\bin\javac.exe" (goto setjavac6) else (goto checkjavac7)
:checkjavac7
if exist "%programfiles%\Java\jdk1.5.0\bin\javac.exe" (goto setjavac7) else (goto checkjavac8)
:checkjavac8
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac8) else (goto checkjavac9)
:checkjavac9
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac9) else (goto checkjavac10)
:checkjavac10
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac10) else (goto checkjavac11)
:checkjavac11
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac11) else (goto checkjavac12)
:checkjavac12
if exist "%programfiles%\Java\jdk1.6.0_20\bin\javac.exe" (goto setjavac12) else (goto javacerror)
:setjavac
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:setjavac2
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:setjavac3
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:setjavac4
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:setjavac5
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:setjavac6
set javac="%programfiles%\Java\jdk1.6.0\bin\javac.exe"
goto compile2
:setjavac7
set javac="%programfiles%\Java\jdk1.5.0\bin\javac.exe"
goto compile2
:setjavac8
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:setjavac9
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:setjavac10
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:setjavac11
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:setjavac12
set javac="%programfiles%\Java\jdk1.6.0_20\bin\javac.exe"
goto compile2
:javacerror
cls
title Error
echo You do not have JDK 5.0 or JDK 6.0. Go to Mod Taharok's tutorial
echo on the Moparscape Tuturoials section for a direct link to download
echo the newest JDK Update.
pause
cls
goto menu
:checkjava
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava) else (goto checkjava2)
:checkjava2
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava2) else (goto checkjava3)
:checkjava3
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava3) else (goto checkjava4)
:checkjava4
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava4) else (goto checkjava5)
:checkjava5
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava5) else (goto checkjava6)
:checkjava6
if exist "%programfiles%\Java\jdk1.6.0\bin\*********" (goto setjava6) else (goto checkjava7)
:checkjava7
if exist "%programfiles%\Java\jdk1.5.0\bin\*********" (goto setjava7) else (goto checkjava8)
:checkjava8
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava8) else (goto checkjava9)
:checkjava9
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava9) else (goto checkjava10)
:checkjava10
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava10) else (goto checkjava11)
:checkjava11
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava11) else (goto checkjava12)
:checkjava12
if exist "%programfiles%\Java\jdk1.6.0_20\bin\*********" (goto setjava12) else (goto javaerror)
:setjava
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:setjava2
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:setjava3
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:setjava4
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:setjava5
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:setjava6
set java="%programfiles%\Java\jdk1.6.0\bin\*********"
goto run2
:setjava7
set java="%programfiles%\Java\jdk1.5.0\bin\*********"
goto run2
:setjava8
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:setjava9
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:setjava10
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:setjava11
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:setjava12
set java="%programfiles%\Java\jdk1.6.0_20\bin\*********"
goto run2
:javaerror
cls
title Error
echo You do not have JDK 5.0 or JDK 6.0. Go to Mod Taharok's tutorial
echo on the Moparscape Tuturoials section for a direct link to download
echo the newest JDK Update.
pause
cls
goto menu